<template>
  <div>
    <el-badge
      v-for="(question, idx) in list"
      :key="idx"
      :value="fill0(idx + 1)"
      class="item"
     
      @click.native="goToNum(idx)"
    >
    </el-badge>
  </div>
</template>

<script>
import { mapState, mapMutations, mapActions } from "vuex";
import tools from "../../api/audit/tools";
export default {
  data() {
    return {};
  },
  async mounted() {
    if (!this.list) {
      await this.getRandList();
    }
    console.log(this.list);
  },
  computed: {
    ...mapState("study", ["index", "list"]),
  },
  methods: {
    ...mapMutations("study", ["SET_INDEX"]),
    ...mapActions("study", ["getRandList"]),
    goToNum(idx) {
      this.SET_INDEX(idx);
    }
  },
  getType(idx) {
    let type = "info";
    // console.log(this.list[idx]);
    let questionObj = this.list[idx];
    if (questionObj.userAnswers) {
      if (questionObj.userAnswers == questionObj.answers) {
        type = "success";
      } else {
        type = "danger";
      }
    } else {
      type = "info";
    }
    if (this.index == idx) {
      type = "primary";
    }
    return type;
  },

  mixins: [tools],
};
</script>

<style scoped>
</style>